---
title: Extensions
summary: API reference for Extensions.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-08-21
library: SAIF.Services.Printing
reference_type: embedded
---

# Extensions

`Extensions` is a small `Module` (declared alongside `XDesignXElement`) that lifts plain LINQ-to-XML
`XElement`/`XDocument` trees into their xPression-aware counterparts, `XDesignXElement` and `SAIFXDocument`. It
is used internally by `XDesignXElement.ToXpression` when a container element's child is a plain `XElement`
rather than an `XDesignXElement`, so mixed trees still serialize correctly.

## Purpose
- Convert a plain `XElement` into an `XDesignXElement` so it can participate in xPression rendering and key
  propagation
- Convert a plain `XDocument` into a `SAIFXDocument` for consistency with the framework's document type

## Context
- Namespace: `SAIF.Services.Printing.Reporting`
- Assembly/package: `SAIF.Services.Printing` (embedded library, project reference)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `ToSAIFXElement` | `<Extension()> Public Function ToSAIFXElement(source As XElement) As XDesignXElement` | Lifts a plain `XElement` into an `XDesignXElement` so it can be rendered by `ToXpression` and participate in key propagation |
| `ToSAIFXDocument` | `<Extension()> Public Function ToSAIFXDocument(source As XDocument) As SAIFXDocument` | Lifts a plain `XDocument` into a `SAIFXDocument` |

## Behavioral notes
- `XDesignXElement.ToXpression` calls `ToSAIFXElement` on any child that is a plain `XElement` before
  recursing into it, so a data tree built with ordinary LINQ-to-XML calls still renders correctly through the
  xPression dialect.*

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- SAIF.Services.Printing/Reporting/XDesignXElement.vb
